﻿using System;
using System.Configuration;
using SMSSender.Common;

namespace SMSSender.Entities.Utils
{
    public class MyConfig
    {
        public string rptAuthenFail;
        public string rptSuccessful;
        public string rptStructureError;
        public string Suport;

        public string rptDataPrice;
        public string PhoneSuport1;
        public string PhoneSuport2;

        public string KeyWord;
        public string rvUserName;
        public string rvPassword;
        public string CustomerID;
        public string ServiceNumber;
        public string ServiceName;

        public string urlWorldGold;
        public string urlVNGold;
        public string urlSJCGold;
        public string urlBTMCGold;
        public string urlSBJGold;
        public int MaximumLengthSMSofGold;

        public MyConfig()
        {
            this.rptAuthenFail = "";
            this.rptSuccessful = "";
            this.rptStructureError = "";
            this.Suport = "";

            this.rptDataPrice = "";
            this.PhoneSuport1 = "";
            this.PhoneSuport2 = "";

            this.KeyWord = "";
            this.rvUserName = "";
            this.rvPassword = "";
            this.CustomerID = "";
            this.ServiceNumber = "";
            this.ServiceName = "";

            this.urlWorldGold = "";
            this.urlVNGold = "";
            this.urlSJCGold = "";
            this.urlBTMCGold = "";
            this.urlSBJGold = "";
            this.MaximumLengthSMSofGold = 0;
        }

        public bool GetMyConfig()
        {
            try
            {
                this.KeyWord = ConfigurationManager.AppSettings["KeyWord"].ToString();
                this.rvUserName = ConfigurationManager.AppSettings["rvUserName"].ToString();
                this.rvPassword = ConfigurationManager.AppSettings["rvPassword"].ToString();
                this.ServiceNumber = ConfigurationManager.AppSettings["ServiceNumber"].ToString();

                return true;
            }
            catch (Exception ex)
            {
                Logger.Error("GetMyConfig Error ! ", ex);
                throw;
            }
        }
    }
}
